﻿Imports System.Windows.Forms

Public Class dlgAddImage

    Public result As String
    Public isLocal As Boolean

    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        If txtLocal.Text = "" And txtURL.Text = "" Then
            MsgBox("Please enter at least something... <3", MsgBoxStyle.Exclamation, "Add Image")
            Exit Sub
        End If

        result = IIf(RadioButton2.Checked, txtLocal.Text, txtURL.Text)
        isLocal = RadioButton2.Checked

        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.Close()
    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
        grpLocal.Enabled = RadioButton2.Checked
        grpRemote.Enabled = Not RadioButton2.Checked
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If openFile.ShowDialog = Windows.Forms.DialogResult.OK Then
            txtLocal.Text = openFile.FileName
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If Clipboard.ContainsText Then txtURL.Text = Clipboard.GetText
    End Sub
End Class
